package net.begincode.searchWeb.controller;

import net.begincode.core.service.SearchService;
import net.begincode.searchCommon.bean.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.io.IOException;
import java.net.URISyntaxException;

/**
 * @author hlj~宇晗
 * @create 2017-03-27 9:30
 **/
@Controller
@RequestMapping("/result")
public class SearchController {

	@Resource
	private SearchService searchService;

	//@RequestMapping(value="/allResults_begincode",method = RequestMethod.POST)
	//public Page all_begincodeResult(int page,String keyword) throws IOException, URISyntaxException {
	//	return SearchService.search("begincode_search",keyword,page);
	//}
	@RequestMapping(value="/allResults_baiduyun",method = RequestMethod.POST)
	public Page all_baiduyunResult(int page,String keyword) throws IOException, URISyntaxException {
		System.out.println("page="+page+"..."+"keyword="+keyword);
		
		return SearchService.search("baiduyun_search",keyword,page);
	}
	@RequestMapping(value="/allResults_begincode",method = RequestMethod.POST)
	public Page all_begincodeResult(int page,String keyword) throws IOException, URISyntaxException {
		System.out.println("page="+page+"..."+"keyword="+keyword);

		return SearchService.search("begincode_search",keyword,page);
	}
}
